package com.tian.job;

import com.tian.dto.LoanPlainDto;
import com.tian.enums.ResultCode;
import com.tian.service.LoanPlainDubboService;
import com.tian.utils.CommonResult;
import org.apache.dubbo.config.annotation.Reference;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

import java.util.Date;

/**
 * @author tianwc  公众号：java后端技术全栈、面试专栏
 * @version 1.0.0
 * @date 2023年08月28日 21:16
 * 在线刷题 1200+题和1000+篇干货文章：<a href="https://woaijava.cc/">博客地址</a>
 */

@Component
public class VerifyTask {

    @Reference(version = "1.0.0")
    private LoanPlainDubboService loanPlainDubboService;
    String path="/";

    @Scheduled(cron = "0/5 * * * * ? ")
    public void parseFile() {


        System.out.println("当前时间：" + new Date());
        CommonResult<LoanPlainDto> loanPlainDtoCommonResult = loanPlainDubboService.queryById(1L);
        if(loanPlainDtoCommonResult.getCode()!= ResultCode.SUCCESS.getCode()){
            System.out.println("失败");
            return;
        }
        System.out.println(loanPlainDtoCommonResult);

        //Verify

        // 批量 insert verify_file_content
    }
//    @Scheduled(cron = "0/5 * * * * ? ")
    public void verify() {
        System.out.println("当前时间：" + new Date());
        CommonResult<LoanPlainDto> loanPlainDtoCommonResult = loanPlainDubboService.queryById(1L);
        if(loanPlainDtoCommonResult.getCode()!= ResultCode.SUCCESS.getCode()){
            System.out.println("失败");
            return;
        }
//        verify_file_content

        System.out.println(loanPlainDtoCommonResult);

//       数据对比

//        if(){
//           // sendMsg();//运营
//        }
    }
//    @Scheduled(cron = "0/5 * * * * ? ")
    public void sendData2Third() {
        System.out.println("当前时间：" + new Date());
        //verify_file_content

        //数据转换

        //发送MQ
    }
}